package hrms.service;

import hrms.dao.AbsenteeismMapper;
import hrms.entity.Absenteeism;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("AbsenteeismService")
public class AbsenteeismService {
    @Autowired
    private AbsenteeismMapper absenteeismMapper;

    public int insertAbsenteeism(Absenteeism absenteeism,Integer staff_id){
        int res = absenteeismMapper.insertAbsenteeism(absenteeism,staff_id);
        return res;
    }
    public int updateAbsenteeism(Absenteeism absenteeism){
        int res = absenteeismMapper.updateAbsenteeism(absenteeism);
        return res;
    }
    public int deleteAbsenteeism(Integer id){
        int res = absenteeismMapper.deleteAbsenteeism(id);
        return res;
    }
    public List<Absenteeism> selectAllAbsenteeism(){
        List<Absenteeism> absenteeisms = absenteeismMapper.selectAllAbsenteeism();
        return absenteeisms;
    }
    public List<Absenteeism> selectAbsenteeismByYear(int year,int month){
        List<Absenteeism> absenteeisms = absenteeismMapper.selectAbsenteeismByYearAndMonth(year,month);
        return absenteeisms;
    }
    public List<Absenteeism> selectAbsenteeismByStaffId(Integer id){
        List<Absenteeism> absenteeisms = absenteeismMapper.selectAbsenteeismByStaffId(id);
        return absenteeisms;
    }
}
